package com.kaizige.realtor.Controller;

import com.kaizige.realtor.Dao.houseOwnerDao;
import com.kaizige.realtor.Dao.recordDao;
import com.kaizige.realtor.Dao.tenantDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;
import java.util.Map;

@Controller
public class queryController {
	@Autowired
	tenantDao td;
	@Autowired
	houseOwnerDao hod;
	@Autowired
	recordDao rd;
	@GetMapping("/manQueOwn")
	public String manQueOwn(Model model){
		List<Map<String, Object>> maps = hod.queryAllOwn();
		model.addAttribute("owners",maps);
		return "/manShow/owners";
	}
	@GetMapping("/manQueTen")
	public String manQueTen(Model model){
		List<Map<String, Object>> maps = td.queryAllTen();
		model.addAttribute("tenants",maps);
		return "/manShow/tenants";
	}
	@GetMapping("/manSeeRec")
	public String manSeeRec(Model model){
		List<Map<String, Object>> maps = rd.getAllRecord();
		model.addAttribute("records",maps);
		return "/manShow/records";
	}
}
